package org.nepu.scr.indexrate.converter.drillingrate.keydevice.wellcontrolsystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.wellcontrolsystem.BopControl;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class BopControlConverter implements AttributeConverter<BopControl, String> {
    @Override
    public String convertToDatabaseColumn(BopControl bopControl) {
        return JSONUtil.toJsonStr(bopControl);
    }

    @Override
    public BopControl convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, BopControl.class);
    }
}
